import os
from dashscope import MultiModalConversation

# 将xxxx/test.png替换为你本地图像的绝对路径
local_path = "2.jpg"
image_path = f"file://{local_path}"
messages = [{"role": "system",
                "content": [{"text": "You are a helpful assistant."}]},
                {'role':'user',
                'content': [{'image': image_path},
                            {'text': '是否为新能源汽车,直接回答"是"or"否"'}]}]
                           
response = MultiModalConversation.call(
    # 若没有配置环境变量，请用百炼API Key将下行替换为：api_key="sk-xxx"
    api_key='sk-af 9193 1484183bc1',
    model='qwen2.5-vl-3b-instruct', # 此处以qwen-vl-max为例，可按需更换模型名称。模型列表：https://help.aliyun.com/zh/model-studio/getting-started/models
    messages=messages)
print(response["output"]["choices"][0]["message"].content[0]["text"])